package com.interview.ujiuye10;

/**
 * Copyright (C), 2018-2020
 * FileName: Demo4
 * Author:   kongfanyu
 * Date:     2020/12/24 下午7:42
 */
public class Demo4 {
    public static void main(String[] args) {

        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + "=-----" + i);
                    if (i == 5){
                        Thread.yield();
                    }
                }
            }
        };

        Thread t1 = new Thread(runnable,"迪丽热巴");
        t1.setPriority(Thread.MAX_PRIORITY);
        t1.start();

        Thread t2 = new Thread(runnable,"欧阳娜娜");
        t2.setPriority(Thread.MIN_PRIORITY);
        t2.start();

    }
}
